<template>
  <div
    class="mailLoading"
    v-loading="loading"
    element-loading-text="拼命加载中"
    style="height: 100%;"
    element-loading-spinner="el-icon-loading"
    element-loading-background="rgba(130, 140, 142, 0.4)"
  ></div>
</template>

<script>
import { bindEmailAddress } from '@/views/MailLoading/MailLoading.js'
export default {
  data() {
    return {
      loading: true,
      mailData: {}
    }
  },
  created() {
    this.getMailData()
  },
  methods: {
    async getMailData() {
      console.log(this.$route.query)
      this.query = this.$route.query
      let mail = this.query.mail
      let tenantId = this.query.tenantId
      let appId = this.query.appId
      let token = this.query.token
      let data = {
        mail: mail
      }
      const { data: res } = await bindEmailAddress(data, {
        headers:{
          tenantId:tenantId,
          appId:appId,
          Authorization:token
        }
      })
      if (res.code == 0) {
        this.loading = false
        this.$message.success('绑定邮箱成功')
        this.$alert('邮箱绑定成功', '邮箱绑定', {
          confirmButtonText: '确定',
          callback: action => {
            this.$message({
              type: 'info',
              message: `action: ${action}`
            })
            window.close()
          }
        })
      }
      console.log(res)
    }
  }
}
</script>
<style scoped lang="less"></style>
